/**
 * This software implements a CAT-1 LTE baseband.
 *
 * Copyright (C) 2015  Optimum Semiconductor Technologies, Inc. info@optimumsemi.com
 *
 * crc24.c -- CRC code for LTE
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.

 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

#include <stdio.h>
#include <stdlib.h>

#include "dl_const.h"
#include "global.h"
#include "turbo_encoder.h"


unsigned short lte_dl_turbo_enc_intlv_params[188][3] =
{
	{40,3,10},
	{48,7,12},
	{56,19,42},
	{64,7,16},
	{72,7,18},
	{80,11,20},
	{88,5,22},
	{96,11,24},
	{104,7,26},
	{112,41,84},
	{120,103,90},
	{128,15,32},
	{136,9,34},
	{144,17,108},
	{152,9,38},
	{160,21,120},
	{168,101,84},
	{176,21,44},
	{184,57,46},
	{192,23,48},
	{200,13,50},
	{208,27,52},
	{216,11,36},
	{224,27,56},
	{232,85,58},
	{240,29,60},
	{248,33,62},
	{256,15,32},
	{264,17,198},
	{272,33,68},
	{280,103,210},
	{288,19,36},
	{296,19,74},
	{304,37,76},
	{312,19,78},
	{320,21,120},
	{328,21,82},
	{336,115,84},
	{344,193,86},
	{352,21,44},
	{360,133,90},
	{368,81,46},
	{376,45,94},
	{384,23,48},
	{392,243,98},
	{400,151,40},
	{408,155,102},
	{416,25,52},
	{424,51,106},
	{432,47,72},
	{440,91,110},
	{448,29,168},
	{456,29,114},
	{464,247,58},
	{472,29,118},
	{480,89,180},
	{488,91,122},
	{496,157,62},
	{504,55,84},
	{512,31,64},
	{528,17,66},
	{544,35,68},
	{560,227,420},
	{576,65,96},
	{592,19,74},
	{608,37,76},
	{624,41,234},
	{640,39,80},
	{656,185,82},
	{672,43,252},
	{688,21,86},
	{704,155,44},
	{720,79,120},
	{736,139,92},
	{752,23,94},
	{768,217,48},
	{784,25,98},
	{800,17,80},
	{816,127,102},
	{832,25,52},
	{848,239,106},
	{864,17,48},
	{880,137,110},
	{896,215,112},
	{912,29,114},
	{928,15,58},
	{944,147,118},
	{960,29,60},
	{976,59,122},
	{992,65,124},
	{1008,55,84},
	{1024,31,64},
	{1056,17,66},
	{1088,171,204},
	{1120,67,140},
	{1152,35,72},
	{1184,19,74},
	{1216,39,76},
	{1248,19,78},
	{1280,199,240},
	{1312,21,82},
	{1344,211,252},
	{1376,21,86},
	{1408,43,88},
	{1440,149,60},
	{1472,45,92},
	{1504,49,846},
	{1536,71,48},
	{1568,13,28},
	{1600,17,80},
	{1632,25,102},
	{1664,183,104},
	{1696,55,954},
	{1728,127,96},
	{1760,27,110},
	{1792,29,112},
	{1824,29,114},
	{1856,57,116},
	{1888,45,354},
	{1920,31,120},
	{1952,59,610},
	{1984,185,124},
	{2016,113,420},
	{2048,31,64},
	{2112,17,66},
	{2176,171,136},
	{2240,209,420},
	{2304,253,216},
	{2368,367,444},
	{2432,265,456},
	{2496,181,468},
	{2560,39,80},
	{2624,27,164},
	{2688,127,504},
	{2752,143,172},
	{2816,43,88},
	{2880,29,300},
	{2944,45,92},
	{3008,157,188},
	{3072,47,96},
	{3136,13,28},
	{3200,111,240},
	{3264,443,204},
	{3328,51,104},
	{3392,51,212},
	{3456,451,192},
	{3520,257,220},
	{3584,57,336},
	{3648,313,228},
	{3712,271,232},
	{3776,179,236},
	{3840,331,120},
	{3904,363,244},
	{3968,375,248},
	{4032,127,168},
	{4096,31,64},
	{4160,33,130},
	{4224,43,264},
	{4288,33,134},
	{4352,477,408},
	{4416,35,138},
	{4480,233,280},
	{4544,357,142},
	{4608,337,480},
	{4672,37,146},
	{4736,71,444},
	{4800,71,120},
	{4864,37,152},
	{4928,39,462},
	{4992,127,234},
	{5056,39,158},
	{5120,39,80},
	{5184,31,96},
	{5248,113,902},
	{5312,41,166},
	{5376,251,336},
	{5440,43,170},
	{5504,21,86},
	{5568,43,174},
	{5632,45,176},
	{5696,45,178},
	{5760,161,120},
	{5824,89,182},
	{5888,323,184},
	{5952,47,186},
	{6016,23,94},
	{6080,47,190},
	{6144,263,480}
};

unsigned short lte_dl_initFs[188][16] =
{
    {0, 13, 6, 19, 12, 25, 18, 31, 24, 37, 30, 3, 36, 9, 2, 15},
    {0, 19, 14, 33, 28, 47, 42, 13, 8, 27, 22, 41, 36, 7, 2, 21},
    {0, 5, 38, 43, 20, 25, 2, 7, 40, 45, 22, 27, 4, 9, 42, 47},
    {0, 23, 14, 37, 28, 51, 42, 1, 56, 15, 6, 29, 20, 43, 34, 57},
    {0, 25, 14, 39, 28, 53, 42, 67, 56, 9, 70, 23, 12, 37, 26, 51},
    {0, 31, 22, 53, 44, 75, 66, 17, 8, 39, 30, 61, 52, 3, 74, 25},
    {0, 27, 10, 37, 20, 47, 30, 57, 40, 67, 50, 77, 60, 87, 70, 9},
    {0, 35, 22, 57, 44, 79, 66, 5, 88, 27, 14, 49, 36, 71, 58, 93},
    {0, 33, 14, 47, 28, 61, 42, 75, 56, 89, 70, 103, 84, 13, 98, 27},
    {0, 13, 82, 95, 52, 65, 22, 35, 104, 5, 74, 87, 44, 57, 14, 27},
    {0, 73, 86, 39, 52, 5, 18, 91, 104, 57, 70, 23, 36, 109, 2, 75},
    {0, 47, 30, 77, 60, 107, 90, 9, 120, 39, 22, 69, 52, 99, 82, 1},
    {0, 43, 18, 61, 36, 79, 54, 97, 72, 115, 90, 133, 108, 15, 126, 33},
    {0, 125, 34, 15, 68, 49, 102, 83, 136, 117, 26, 7, 60, 41, 94, 75},
    {0, 47, 18, 65, 36, 83, 54, 101, 72, 119, 90, 137, 108, 3, 126, 21},
    {0, 141, 42, 23, 84, 65, 126, 107, 8, 149, 50, 31, 92, 73, 134, 115},
    {0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 2, 19, 36, 53, 70, 87},
    {0, 65, 42, 107, 84, 149, 126, 15, 168, 57, 34, 99, 76, 141, 118, 7},
    {0, 103, 114, 33, 44, 147, 158, 77, 88, 7, 18, 121, 132, 51, 62, 165},
    {0, 71, 46, 117, 92, 163, 138, 17, 184, 63, 38, 109, 84, 155, 130, 9},
    {0, 63, 26, 89, 52, 115, 78, 141, 104, 167, 130, 193, 156, 19, 182, 45},
    {0, 79, 54, 133, 108, 187, 162, 33, 8, 87, 62, 141, 116, 195, 170, 41},
    {0, 47, 166, 141, 188, 91, 66, 113, 16, 207, 38, 157, 132, 179, 82, 57},
    {0, 83, 54, 137, 108, 191, 162, 21, 216, 75, 46, 129, 100, 183, 154, 13},
    {0, 143, 170, 81, 108, 19, 46, 189, 216, 127, 154, 65, 92, 3, 30, 173},
    {0, 89, 58, 147, 116, 205, 174, 23, 232, 81, 50, 139, 108, 197, 166, 15},
    {0, 95, 66, 161, 132, 227, 198, 45, 16, 111, 82, 177, 148, 243, 214, 61},
    {0, 47, 158, 77, 60, 107, 218, 137, 120, 167, 22, 197, 180, 227, 82, 1},
    {0, 215, 34, 249, 68, 19, 102, 53, 136, 87, 170, 121, 204, 155, 238, 189},
    {0, 101, 66, 167, 132, 233, 198, 27, 264, 93, 58, 159, 124, 225, 190, 19},
    {0, 33, 206, 239, 132, 165, 58, 91, 264, 17, 190, 223, 116, 149, 42, 75},
    {0, 55, 182, 93, 76, 131, 258, 169, 152, 207, 46, 245, 228, 283, 122, 33},
    {0, 93, 38, 131, 76, 169, 114, 207, 152, 245, 190, 283, 228, 25, 266, 63},
    {0, 113, 74, 187, 148, 261, 222, 31, 296, 105, 66, 179, 140, 253, 214, 23},
    {0, 97, 38, 135, 76, 173, 114, 211, 152, 249, 190, 287, 228, 13, 266, 51},
    {0, 141, 202, 183, 84, 225, 286, 267, 168, 309, 50, 31, 252, 73, 134, 115},
    {0, 103, 42, 145, 84, 187, 126, 229, 168, 271, 210, 313, 252, 27, 294, 69},
    {0, 199, 230, 93, 124, 323, 18, 217, 248, 111, 142, 5, 36, 235, 266, 129},
    {0, 279, 42, 321, 84, 19, 126, 61, 168, 103, 210, 145, 252, 187, 294, 229},
    {0, 65, 218, 107, 84, 149, 302, 191, 168, 233, 34, 275, 252, 317, 118, 7},
    {0, 223, 266, 129, 172, 35, 78, 301, 344, 207, 250, 113, 156, 19, 62, 285},
    {0, 127, 346, 289, 324, 83, 302, 245, 280, 39, 258, 201, 236, 363, 214, 157},
    {0, 139, 90, 229, 180, 319, 270, 33, 360, 123, 74, 213, 164, 303, 254, 17},
    {0, 71, 238, 117, 92, 163, 330, 209, 184, 255, 38, 301, 276, 347, 130, 9},
    {0, 341, 94, 43, 188, 137, 282, 231, 376, 325, 78, 27, 172, 121, 266, 215},
    {0, 191, 62, 13, 44, 155, 346, 217, 168, 199, 310, 101, 372, 323, 354, 65},
    {0, 257, 310, 159, 212, 61, 114, 371, 16, 273, 326, 175, 228, 77, 130, 387},
    {0, 77, 258, 127, 100, 177, 358, 227, 200, 277, 42, 327, 300, 377, 142, 11},
    {0, 157, 102, 259, 204, 361, 306, 39, 408, 141, 86, 243, 188, 345, 290, 23},
    {0, 119, 382, 357, 44, 307, 282, 401, 232, 207, 326, 157, 132, 251, 82, 57},
    {0, 201, 182, 383, 364, 125, 106, 307, 288, 49, 30, 231, 212, 413, 394, 155},
    {0, 197, 282, 255, 116, 313, 398, 371, 232, 429, 66, 39, 348, 97, 182, 155},
    {0, 143, 58, 201, 116, 259, 174, 317, 232, 375, 290, 433, 348, 35, 406, 93},
    {0, 305, 262, 335, 60, 365, 322, 395, 120, 425, 382, 455, 180, 21, 442, 51},
    {0, 147, 58, 205, 116, 263, 174, 321, 232, 379, 290, 437, 348, 23, 406, 81},
    {0, 269, 418, 447, 356, 145, 294, 323, 232, 21, 170, 199, 108, 377, 46, 75},
    {0, 213, 182, 395, 364, 89, 58, 271, 240, 453, 422, 147, 116, 329, 298, 23},
    {0, 219, 66, 37, 132, 351, 198, 169, 264, 483, 330, 301, 396, 119, 462, 433},
    {0, 139, 446, 417, 52, 359, 330, 469, 272, 243, 382, 185, 156, 295, 98, 69},
    {0, 95, 318, 157, 124, 219, 442, 281, 248, 343, 54, 405, 372, 467, 178, 17},
    {0, 83, 298, 117, 68, 151, 366, 185, 136, 219, 434, 253, 204, 287, 502, 321},
    {0, 103, 342, 173, 140, 243, 482, 313, 280, 383, 78, 453, 420, 523, 218, 49},
    {0, 87, 454, 541, 348, 435, 242, 329, 136, 223, 30, 117, 484, 11, 378, 465},
    {0, 161, 514, 483, 68, 421, 390, 551, 328, 297, 458, 235, 204, 365, 142, 111},
    {0, 93, 334, 131, 76, 169, 410, 207, 152, 245, 486, 283, 228, 321, 562, 359},
    {0, 113, 378, 187, 148, 261, 526, 335, 296, 409, 66, 483, 444, 557, 214, 23},
    {0, 275, 394, 357, 164, 439, 558, 521, 328, 603, 98, 61, 492, 143, 262, 225},
    {0, 119, 398, 197, 156, 275, 554, 353, 312, 431, 70, 509, 468, 587, 226, 25},
    {0, 267, 42, 637, 84, 351, 126, 65, 168, 435, 210, 149, 252, 519, 294, 233},
    {0, 295, 422, 381, 172, 467, 594, 553, 344, 639, 94, 53, 516, 139, 266, 225},
    {0, 107, 386, 149, 84, 191, 470, 233, 168, 275, 554, 317, 252, 359, 638, 401},
    {0, 199, 486, 157, 620, 467, 402, 425, 536, 31, 318, 693, 452, 299, 234, 257},
    {0, 199, 638, 597, 76, 515, 474, 673, 392, 351, 550, 269, 228, 427, 146, 105},
    {0, 231, 646, 509, 556, 51, 466, 329, 376, 607, 286, 149, 196, 427, 106, 705},
    {0, 117, 422, 163, 92, 209, 514, 255, 184, 301, 606, 347, 276, 393, 698, 439},
    {0, 265, 626, 315, 100, 749, 726, 31, 200, 465, 58, 515, 300, 181, 158, 231},
    {0, 123, 442, 173, 100, 223, 542, 273, 200, 323, 642, 373, 300, 423, 742, 473},
    {0, 97, 354, 771, 548, 485, 582, 39, 456, 233, 170, 267, 524, 141, 718, 655},
    {0, 229, 662, 483, 508, 737, 354, 175, 200, 429, 46, 683, 708, 121, 554, 375},
    {0, 77, 258, 543, 100, 593, 358, 227, 200, 277, 458, 743, 300, 793, 558, 427},
    {0, 345, 54, 823, 108, 453, 162, 83, 216, 561, 270, 191, 324, 669, 378, 299},
    {0, 65, 226, 483, 836, 421, 102, 743, 616, 585, 650, 811, 204, 557, 142, 687},
    {0, 247, 714, 521, 548, 795, 382, 189, 216, 463, 50, 737, 764, 131, 598, 405},
    {0, 327, 878, 757, 860, 291, 842, 721, 824, 255, 806, 685, 788, 219, 770, 649},
    {0, 143, 514, 201, 116, 259, 630, 317, 232, 375, 746, 433, 348, 491, 862, 549},
    {0, 73, 262, 567, 60, 597, 322, 163, 120, 193, 382, 687, 180, 717, 442, 283},
    {0, 265, 766, 559, 588, 853, 410, 203, 232, 497, 54, 791, 820, 141, 642, 435},
    {0, 89, 298, 627, 116, 685, 414, 263, 232, 321, 530, 859, 348, 917, 646, 495},
    {0, 181, 606, 299, 236, 417, 842, 535, 472, 653, 102, 771, 708, 889, 338, 31},
    {0, 189, 626, 319, 260, 449, 886, 579, 520, 709, 154, 839, 780, 969, 414, 107},
    {0, 139, 446, 921, 556, 359, 330, 469, 776, 243, 886, 689, 660, 799, 98, 573},
    {0, 95, 318, 669, 124, 731, 442, 281, 248, 343, 566, 917, 372, 979, 690, 529},
    {0, 83, 298, 645, 68, 679, 366, 185, 136, 219, 434, 781, 204, 815, 502, 321},
    {0, 375, 70, 173, 684, 515, 754, 313, 280, 655, 350, 453, 964, 795, 1034, 593},
    {0, 207, 694, 341, 268, 475, 962, 609, 536, 743, 110, 877, 804, 1011, 378, 25},
    {0, 107, 358, 753, 140, 823, 498, 317, 280, 387, 638, 1033, 420, 1103, 778, 597},
    {0, 93, 334, 723, 76, 761, 410, 207, 152, 245, 486, 875, 228, 913, 562, 359},
    {0, 115, 382, 801, 156, 879, 538, 349, 312, 427, 694, 1113, 468, 1191, 850, 661},
    {0, 97, 350, 759, 76, 797, 426, 211, 152, 249, 502, 911, 228, 949, 578, 363},
    {0, 439, 78, 197, 796, 595, 874, 353, 312, 751, 390, 509, 1108, 907, 1186, 665},
    {0, 103, 370, 801, 84, 843, 454, 229, 168, 271, 538, 969, 252, 1011, 622, 397},
    {0, 463, 86, 213, 844, 635, 930, 385, 344, 807, 430, 557, 1188, 979, 1274, 729},
    {0, 107, 386, 837, 84, 879, 470, 233, 168, 275, 554, 1005, 252, 1047, 638, 401},
    {0, 131, 438, 921, 172, 1007, 610, 389, 344, 475, 782, 1265, 516, 1351, 954, 733},
    {0, 209, 538, 987, 116, 805, 174, 1103, 712, 441, 290, 259, 348, 557, 886, 1335},
    {0, 137, 458, 963, 180, 1053, 638, 407, 360, 497, 818, 1323, 540, 1413, 998, 767},
    {0, 895, 474, 241, 196, 339, 670, 1189, 392, 1287, 866, 633, 588, 731, 1062, 77},
    {0, 119, 334, 645, 1052, 19, 618, 1313, 568, 1455, 902, 445, 84, 1355, 1186, 1113},
    {0, 41, 138, 291, 500, 765, 1086, 1463, 328, 817, 1362, 395, 1052, 197, 966, 223},
    {0, 97, 354, 771, 1348, 485, 1382, 839, 456, 233, 170, 267, 524, 941, 1518, 655},
    {0, 127, 458, 993, 100, 1043, 558, 277, 200, 327, 658, 1193, 300, 1243, 758, 477},
    {0, 287, 782, 1485, 732, 187, 1514, 1385, 1464, 87, 582, 1285, 532, 1651, 1314, 1185},
    {0, 1009, 534, 271, 220, 381, 754, 1339, 440, 1449, 974, 711, 660, 821, 1194, 83},
    {0, 223, 638, 1245, 316, 1307, 762, 409, 248, 279, 502, 917, 1524, 595, 1586, 1041},
    {0, 137, 494, 1071, 108, 1125, 602, 299, 216, 353, 710, 1287, 324, 1341, 818, 515},
    {0, 141, 506, 1095, 116, 1153, 622, 315, 232, 373, 738, 1327, 348, 1385, 854, 547},
    {0, 143, 514, 1113, 116, 1171, 630, 317, 232, 375, 746, 1345, 348, 1403, 862, 549},
    {0, 173, 578, 1215, 228, 1329, 806, 515, 456, 629, 1034, 1671, 684, 1785, 1262, 971},
    {0, 399, 1506, 1433, 180, 1523, 1686, 669, 360, 759, 1866, 1793, 540, 1883, 158, 1029},
    {0, 151, 542, 1173, 124, 1235, 666, 337, 248, 399, 790, 1421, 372, 1483, 914, 585},
    {0, 669, 606, 1763, 236, 1881, 842, 1023, 472, 1141, 1078, 283, 708, 401, 1314, 1495},
    {0, 309, 866, 1671, 740, 57, 1606, 1419, 1480, 1789, 362, 1167, 236, 1537, 1102, 915},
    {0, 533, 1906, 87, 1124, 985, 1686, 1211, 1576, 765, 794, 1663, 1356, 1889, 1246, 1443},
    {0, 95, 318, 669, 1148, 1755, 442, 1305, 248, 1367, 566, 1941, 1396, 979, 690, 529},
    {0, 83, 298, 645, 1124, 1735, 366, 1241, 136, 1275, 434, 1837, 1260, 815, 502, 321},
    {0, 307, 886, 1737, 684, 2079, 1570, 1333, 1368, 1675, 78, 929, 2052, 1271, 762, 525},
    {0, 629, 2098, 2167, 836, 345, 694, 1883, 1672, 61, 1530, 1599, 268, 2017, 126, 1315},
    {0, 469, 1370, 399, 2164, 2057, 78, 835, 2024, 1341, 1090, 1271, 1884, 625, 2102, 1707},
    {0, 811, 142, 361, 1468, 1095, 1610, 645, 568, 1379, 710, 929, 2036, 1663, 2178, 1213},
    {0, 721, 2354, 35, 1060, 565, 982, 2311, 2120, 409, 2042, 2155, 748, 253, 670, 1999},
    {0, 649, 2234, 2259, 724, 125, 462, 1735, 1448, 2097, 1186, 1211, 2172, 1573, 1910, 687},
    {0, 119, 398, 837, 1436, 2195, 554, 1633, 312, 1711, 710, 2429, 1748, 1227, 866, 665},
    {0, 191, 710, 1557, 108, 1611, 818, 353, 216, 407, 926, 1773, 324, 1827, 1034, 569},
    {0, 631, 2270, 2229, 508, 2483, 90, 1393, 1016, 1647, 598, 557, 1524, 811, 1106, 2409},
    {0, 315, 974, 1977, 572, 2263, 1546, 1173, 1144, 1459, 2118, 369, 1716, 655, 2690, 2317},
    {0, 131, 438, 921, 1580, 2415, 610, 1797, 344, 1883, 782, 2673, 1924, 1351, 954, 733},
    {0, 329, 1258, 2787, 2036, 1885, 2334, 503, 2152, 1521, 1490, 2059, 348, 2117, 1606, 1695},
    {0, 137, 458, 963, 1652, 2525, 638, 1879, 360, 1969, 818, 2795, 2012, 1413, 998, 767},
    {0, 345, 1066, 2163, 628, 2477, 1694, 1287, 1256, 1601, 2322, 411, 1884, 725, 2950, 2543},
    {0, 143, 478, 1005, 1724, 2635, 666, 1961, 376, 2055, 854, 2917, 2100, 1475, 1042, 801},
    {0, 41, 138, 291, 500, 765, 1086, 1463, 1896, 2385, 2930, 395, 1052, 1765, 2534, 223},
    {0, 351, 1182, 2493, 1084, 155, 2906, 2937, 248, 1239, 2710, 1461, 692, 403, 594, 1265},
    {0, 647, 1702, 3165, 1772, 787, 210, 41, 280, 927, 1982, 181, 2052, 1067, 490, 321},
    {0, 155, 518, 1089, 1868, 2855, 722, 2125, 408, 2227, 926, 3161, 2276, 1599, 1130, 869},
    {0, 263, 950, 2061, 204, 2163, 1154, 569, 408, 671, 1358, 2469, 612, 2571, 1562, 977},
    {0, 643, 1670, 3081, 1420, 143, 2706, 2197, 2072, 2331, 2974, 545, 1956, 295, 2474, 1581},
    {0, 477, 1394, 2751, 1028, 3265, 2422, 2019, 2056, 2533, 3450, 1287, 3084, 1801, 958, 555},
    {0, 393, 1458, 3195, 2020, 1517, 1686, 2527, 456, 2641, 1914, 1859, 2476, 181, 2142, 1191},
    {0, 541, 1538, 2991, 1252, 3617, 2790, 2419, 2504, 3045, 394, 1847, 108, 2473, 1646, 1275},
    {0, 503, 1470, 2901, 1084, 3443, 2554, 2129, 2168, 2671, 3638, 1357, 3252, 1899, 1010, 585},
    {0, 415, 1302, 2661, 716, 3019, 2018, 1489, 1432, 1847, 2734, 317, 2148, 675, 3450, 2921},
    {0, 451, 1142, 2073, 3244, 815, 2466, 517, 2648, 1179, 3790, 2801, 2052, 1543, 1274, 1245},
    {0, 607, 1702, 3285, 1452, 107, 3154, 2785, 2904, 3511, 702, 2285, 452, 3011, 2154, 1785},
    {0, 623, 1742, 3357, 1500, 139, 3242, 2873, 3000, 3623, 774, 2389, 532, 3139, 2274, 1905},
    {0, 295, 926, 1893, 3196, 803, 2778, 1057, 3704, 2655, 1942, 1565, 1524, 1819, 2450, 3417},
    {0, 95, 318, 669, 1148, 1755, 2490, 3353, 248, 1367, 2614, 3989, 1396, 3027, 690, 2577},
    {0, 163, 586, 1269, 2212, 3415, 718, 2441, 264, 2507, 850, 3613, 2476, 1599, 982, 625},
    {0, 307, 1142, 2505, 172, 2591, 1314, 565, 344, 651, 1486, 2849, 516, 2935, 1658, 909},
    {0, 167, 602, 1305, 2276, 3515, 734, 2509, 264, 2575, 866, 3713, 2540, 1635, 998, 629},
    {0, 885, 2586, 751, 4084, 3881, 142, 1571, 3816, 2525, 2050, 2391, 3548, 1169, 3958, 3211},
    {0, 173, 622, 1347, 2348, 3625, 762, 2591, 280, 2661, 902, 3835, 2628, 1697, 1042, 663},
    {0, 513, 1586, 3219, 932, 3685, 2518, 1911, 1864, 2377, 3450, 603, 2796, 1069, 4382, 3775},
    {0, 499, 1282, 2349, 3700, 791, 2710, 369, 2856, 1083, 4138, 2933, 2012, 1375, 1022, 953},
    {0, 817, 2594, 723, 4420, 4469, 870, 2839, 1160, 441, 682, 1883, 4044, 2557, 2030, 2463},
    {0, 183, 658, 1425, 2484, 3835, 806, 2741, 296, 2815, 954, 4057, 2780, 1795, 1102, 701},
    {0, 515, 1918, 4209, 2652, 1983, 2202, 3309, 568, 3451, 2486, 2409, 3220, 183, 2770, 1509},
    {0, 191, 622, 1293, 2204, 3355, 4746, 1577, 3448, 759, 3110, 901, 3732, 2003, 514, 4065},
    {0, 189, 682, 1479, 2580, 3985, 830, 2843, 296, 2917, 978, 4207, 2876, 1849, 1126, 707},
    {0, 501, 1926, 4275, 2620, 1889, 2082, 3199, 312, 3277, 2238, 2123, 2932, 4665, 2394, 1047},
    {0, 361, 1190, 2487, 4252, 1493, 4194, 2371, 1016, 129, 4702, 4751, 276, 1261, 2714, 4635},
    {0, 197, 710, 1539, 2684, 4145, 866, 2959, 312, 3037, 1022, 4379, 2996, 1929, 1178, 743},
    {0, 119, 398, 837, 1436, 2195, 3114, 4193, 312, 1711, 3270, 4989, 1748, 3787, 866, 3225},
    {0, 127, 446, 957, 1660, 2555, 3642, 4921, 1208, 2871, 4726, 1589, 3828, 1075, 3698, 1329},
    {0, 1015, 3834, 3209, 4388, 2123, 1662, 3005, 904, 607, 2114, 177, 44, 1715, 5190, 5221},
    {0, 207, 746, 1617, 2820, 4355, 910, 3109, 328, 3191, 1074, 4601, 3148, 2027, 1238, 781},
    {0, 587, 1846, 3777, 1004, 4279, 2850, 2093, 2008, 2595, 3854, 409, 3012, 911, 4858, 4101},
    {0, 213, 766, 1659, 2892, 4465, 938, 3191, 344, 3277, 1110, 4723, 3236, 2089, 1282, 815},
    {0, 107, 386, 837, 1460, 2255, 3222, 4361, 168, 1651, 3306, 5133, 1628, 3799, 638, 3153},
    {0, 217, 782, 1695, 2956, 4565, 954, 3259, 344, 3345, 1126, 4823, 3300, 2125, 1298, 819},
    {0, 221, 794, 1719, 2996, 4625, 974, 3307, 360, 3397, 1154, 4895, 3356, 2169, 1334, 851},
    {0, 223, 802, 1737, 3028, 4675, 982, 3341, 360, 3431, 1162, 4945, 3388, 2187, 1342, 853},
    {0, 281, 802, 1563, 2564, 3805, 5286, 1247, 3208, 5409, 2090, 4771, 1932, 5093, 2734, 615},
    {0, 271, 906, 1905, 3268, 4995, 1262, 3717, 712, 3895, 1618, 5529, 3980, 2795, 1974, 1517},
    {0, 507, 1382, 2625, 4236, 327, 2674, 5389, 2584, 147, 3966, 2265, 932, 5855, 5258, 5029},
    {0, 233, 838, 1815, 3164, 4885, 1026, 3491, 376, 3585, 1214, 5167, 3540, 2285, 1402, 891},
    {0, 117, 422, 915, 1596, 2465, 3522, 4767, 184, 1805, 3614, 5611, 1780, 4153, 698, 3447},
    {0, 237, 854, 1851, 3228, 4985, 1042, 3559, 376, 3653, 1230, 5267, 3604, 2321, 1418, 895},
    {0, 743, 2446, 5109, 2588, 1027, 426, 785, 2104, 4383, 1478, 5677, 4692, 4667, 5602, 1353}
};

short lte_dl_initFwdParams0[188][3] =
{
	{0,8,-1},
	{0,16,-1},
	{0,24,-1},
	{0,48,-1},
	{0,40,-1},
	{0,16,-1},
	{0,80,-1},
	{0,80,-1},
	{0,8,-1},
	{0,96,-1},
	{0,88,-1},
	{0,112,-1},
	{0,8,-1},
	{0,128,-1},
	{0,144,-1},
	{0,16,-1},
	{0,104,-1},
	{0,160,-1},
	{0,176,-1},
	{0,176,-1},
	{0,8,-1},
	{0,16,-1},
	{72,-1,0},
	{0,208,-1},
	{0,200,-1},
	{0,224,-1},
	{0,32,-1},
	{0,240,-1},
	{0,8,-1},
	{0,256,-1},
	{0,248,-1},
	{0,16,-1},
	{0,8,-1},
	{0,288,-1},
	{0,304,-1},
	{0,16,-1},
	{0,8,-1},
	{0,160,-1},
	{0,336,-1},
	{0,336,-1},
	{0,328,-1},
	{0,192,-1},
	{0,344,-1},
	{0,368,-1},
	{0,360,-1},
	{80,-1,1},
	{0,32,-1},
	{0,400,-1},
	{0,392,-1},
	{144,-1,2},
	{0,136,-1},
	{0,16,-1},
	{0,8,-1},
	{0,240,-1},
	{0,464,-1},
	{0,464,-1},
	{0,480,-1},
	{0,32,-1},
	{168,-1,3},
	{0,496,-1},
	{0,272,-1},
	{0,16,-1},
	{0,272,-1},
	{192,-1,4},
	{0,304,-1},
	{0,592,-1},
	{0,32,-1},
	{0,624,-1},
	{0,336,-1},
	{0,16,-1},
	{0,336,-1},
	{0,368,-1},
	{240,-1,5},
	{0,16,-1},
	{0,368,-1},
	{0,400,-1},
	{0,400,-1},
	{160,-1,6},
	{0,400,-1},
	{0,400,-1},
	{0,432,-1},
	{384,-1,7},
	{0,432,-1},
	{0,752,-1},
	{0,464,-1},
	{0,240,-1},
	{0,464,-1},
	{0,464,-1},
	{0,944,-1},
	{0,48,-1},
	{672,-1,8},
	{0,496,-1},
	{0,272,-1},
	{0,560,-1},
	{0,1072,-1},
	{0,560,-1},
	{0,304,-1},
	{0,624,-1},
	{0,304,-1},
	{0,624,-1},
	{0,336,-1},
	{0,688,-1},
	{0,336,-1},
	{0,688,-1},
	{480,-1,9},
	{0,720,-1},
	{0,784,-1},
	{0,1136,-1},
	{224,-1,10},
	{960,-1,11},
	{0,400,-1},
	{0,1264,-1},
	{0,880,-1},
	{768,-1,12},
	{0,432,-1},
	{0,464,-1},
	{0,464,-1},
	{0,912,-1},
	{0,720,-1},
	{0,496,-1},
	{0,944,-1},
	{0,976,-1},
	{1344,-1,13},
	{0,496,-1},
	{0,272,-1},
	{0,560,-1},
	{0,1104,-1},
	{0,1744,-1},
	{0,1136,-1},
	{0,1808,-1},
	{0,400,-1},
	{0,624,-1},
	{0,432,-1},
	{0,2032,-1},
	{0,2288,-1},
	{0,688,-1},
	{960,-1,14},
	{0,720,-1},
	{0,2512,-1},
	{0,752,-1},
	{1792,-1,15},
	{1280,-1,16},
	{0,560,-1},
	{0,816,-1},
	{0,816,-1},
	{1536,-1,17},
	{0,592,-1},
	{0,912,-1},
	{0,1360,-1},
	{0,624,-1},
	{0,2864,-1},
	{0,1456,-1},
	{0,1904,-1},
	{0,2032,-1},
	{1344,-1,18},
	{0,-1,19},
	{0,528,-1},
	{0,688,-1},
	{0,528,-1},
	{0,3280,-1},
	{0,560,-1},
	{0,3728,-1},
	{0,1168,-1},
	{1536,-1,20},
	{0,592,-1},
	{0,1136,-1},
	{3840,-1,21},
	{0,592,-1},
	{0,624,-1},
	{0,-1,22},
	{0,624,-1},
	{0,-1,23},
	{2496,-1,24},
	{0,-1,25},
	{0,656,-1},
	{0,4016,-1},
	{0,688,-1},
	{0,-1,26},
	{0,688,-1},
	{0,720,-1},
	{0,720,-1},
	{3840,-1,27},
	{0,1424,-1},
	{0,5168,-1},
	{0,752,-1},
	{0,-1,28},
	{0,752,-1},
	{0,-1,29}
};

unsigned short lte_dl_initFwdParams1[30][16] =
{
    {104, 176, 32, 104, 176, 32, 104, 176, 32, 104, 176, 32, 104, 176, 32, 104},
    {256, 336, 16, 96, 176, 256, 336, 16, 96, 176, 256, 336, 16, 96, 176, 256},
    {176, 320, 32, 176, 320, 32, 176, 320, 32, 176, 320, 32, 176, 320, 32, 176},
    {208, 376, 40, 208, 376, 40, 208, 376, 40, 208, 376, 40, 208, 376, 40, 208},
    {272, 464, 80, 272, 464, 80, 272, 464, 80, 272, 464, 80, 272, 464, 80, 272},
    {304, 544, 64, 304, 544, 64, 304, 544, 64, 304, 544, 64, 304, 544, 64, 304},
    {752, 112, 272, 432, 592, 752, 112, 272, 432, 592, 752, 112, 272, 432, 592, 752},
    {464, 272, 80, 752, 560, 368, 176, 848, 656, 464, 272, 80, 752, 560, 368, 176},
    {208, 880, 544, 208, 880, 544, 208, 880, 544, 208, 880, 544, 208, 880, 544, 208},
    {464, 944, 1424, 464, 944, 1424, 464, 944, 1424, 464, 944, 1424, 464, 944, 1424, 464},
    {1104, 432, 1328, 656, 1552, 880, 208, 1104, 432, 1328, 656, 1552, 880, 208, 1104, 432},
    {1552, 912, 272, 1232, 592, 1552, 912, 272, 1232, 592, 1552, 912, 272, 1232, 592, 1552},
    {688, 304, 1648, 1264, 880, 496, 112, 1456, 1072, 688, 304, 1648, 1264, 880, 496, 112},
    {464, 1808, 1136, 464, 1808, 1136, 464, 1808, 1136, 464, 1808, 1136, 464, 1808, 1136, 464},
    {2384, 464, 1424, 2384, 464, 1424, 2384, 464, 1424, 2384, 464, 1424, 2384, 464, 1424, 2384},
    {1104, 2000, 2896, 656, 1552, 2448, 208, 1104, 2000, 2896, 656, 1552, 2448, 208, 1104, 2000},
    {2416, 496, 1776, 3056, 1136, 2416, 496, 1776, 3056, 1136, 2416, 496, 1776, 3056, 1136, 2416},
    {1072, 304, 2992, 2224, 1456, 688, 3376, 2608, 1840, 1072, 304, 2992, 2224, 1456, 688, 3376},
    {688, 2032, 3376, 688, 2032, 3376, 688, 2032, 3376, 688, 2032, 3376, 688, 2032, 3376, 688},
    {496, 2544, 496, 2544, 496, 2544, 496, 2544, 496, 2544, 496, 2544, 496, 2544, 496, 2544},
    {3856, 784, 2320, 3856, 784, 2320, 3856, 784, 2320, 3856, 784, 2320, 3856, 784, 2320, 3856},
    {3056, 2096, 1136, 176, 4016, 3056, 2096, 1136, 176, 4016, 3056, 2096, 1136, 176, 4016, 3056},
    {2032, 4528, 2032, 4528, 2032, 4528, 2032, 4528, 2032, 4528, 2032, 4528, 2032, 4528, 2032, 4528},
    {624, 3184, 624, 3184, 624, 3184, 624, 3184, 624, 3184, 624, 3184, 624, 3184, 624, 3184},
    {4336, 2224, 112, 3184, 1072, 4144, 2032, 5104, 2992, 880, 3952, 1840, 4912, 2800, 688, 3760},
    {1808, 4432, 1808, 4432, 1808, 4432, 1808, 4432, 1808, 4432, 1808, 4432, 1808, 4432, 1808, 4432},
    {336, 3088, 336, 3088, 336, 3088, 336, 3088, 336, 3088, 336, 3088, 336, 3088, 336, 3088},
    {4496, 2576, 656, 4496, 2576, 656, 4496, 2576, 656, 4496, 2576, 656, 4496, 2576, 656, 4496},
    {368, 3376, 368, 3376, 368, 3376, 368, 3376, 368, 3376, 368, 3376, 368, 3376, 368, 3376},
    {4208, 1136, 4208, 1136, 4208, 1136, 4208, 1136, 4208, 1136, 4208, 1136, 4208, 1136, 4208, 1136}
};
static short KindexTable[764]= {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,-1,60,-1,61,-1,62,-1,63,-1,64,-1,65,-1,66,-1,67,-1,68,-1,69,-1,70,-1,71,-1,72,-1,73,-1,74,-1,75,-1,76,-1,77,-1,78,-1,79,-1,80,-1,81,-1,82,-1,83,-1,84,-1,85,-1,86,-1,87,-1,88,-1,89,-1,90,-1,91,-1,-1,-1,92,-1,-1,-1,93,-1,-1,-1,94,-1,-1,-1,95,-1,-1,-1,96,-1,-1,-1,97,-1,-1,-1,98,-1,-1,-1,99,-1,-1,-1,100,-1,-1,-1,101,-1,-1,-1,102,-1,-1,-1,103,-1,-1,-1,104,-1,-1,-1,105,-1,-1,-1,106,-1,-1,-1,107,-1,-1,-1,108,-1,-1,-1,109,-1,-1,-1,110,-1,-1,-1,111,-1,-1,-1,112,-1,-1,-1,113,-1,-1,-1,114,-1,-1,-1,115,-1,-1,-1,116,-1,-1,-1,117,-1,-1,-1,118,-1,-1,-1,119,-1,-1,-1,120,-1,-1,-1,121,-1,-1,-1,122,-1,-1,-1,123,-1,-1,-1,-1,-1,-1,-1,124,-1,-1,-1,-1,-1,-1,-1,125,-1,-1,-1,-1,-1,-1,-1,126,-1,-1,-1,-1,-1,-1,-1,127,-1,-1,-1,-1,-1,-1,-1,128,-1,-1,-1,-1,-1,-1,-1,129,-1,-1,-1,-1,-1,-1,-1,130,-1,-1,-1,-1,-1,-1,-1,131,-1,-1,-1,-1,-1,-1,-1,132,-1,-1,-1,-1,-1,-1,-1,133,-1,-1,-1,-1,-1,-1,-1,134,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,136,-1,-1,-1,-1,-1,-1,-1,137,-1,-1,-1,-1,-1,-1,-1,138,-1,-1,-1,-1,-1,-1,-1,139,-1,-1,-1,-1,-1,-1,-1,140,-1,-1,-1,-1,-1,-1,-1,141,-1,-1,-1,-1,-1,-1,-1,142,-1,-1,-1,-1,-1,-1,-1,143,-1,-1,-1,-1,-1,-1,-1,144,-1,-1,-1,-1,-1,-1,-1,145,-1,-1,-1,-1,-1,-1,-1,146,-1,-1,-1,-1,-1,-1,-1,147,-1,-1,-1,-1,-1,-1,-1,148,-1,-1,-1,-1,-1,-1,-1,149,-1,-1,-1,-1,-1,-1,-1,150,-1,-1,-1,-1,-1,-1,-1,151,-1,-1,-1,-1,-1,-1,-1,152,-1,-1,-1,-1,-1,-1,-1,153,-1,-1,-1,-1,-1,-1,-1,154,-1,-1,-1,-1,-1,-1,-1,155,-1,-1,-1,-1,-1,-1,-1,156,-1,-1,-1,-1,-1,-1,-1,157,-1,-1,-1,-1,-1,-1,-1,158,-1,-1,-1,-1,-1,-1,-1,159,-1,-1,-1,-1,-1,-1,-1,160,-1,-1,-1,-1,-1,-1,-1,161,-1,-1,-1,-1,-1,-1,-1,162,-1,-1,-1,-1,-1,-1,-1,163,-1,-1,-1,-1,-1,-1,-1,164,-1,-1,-1,-1,-1,-1,-1,165,-1,-1,-1,-1,-1,-1,-1,166,-1,-1,-1,-1,-1,-1,-1,167,-1,-1,-1,-1,-1,-1,-1,168,-1,-1,-1,-1,-1,-1,-1,169,-1,-1,-1,-1,-1,-1,-1,170,-1,-1,-1,-1,-1,-1,-1,171,-1,-1,-1,-1,-1,-1,-1,172,-1,-1,-1,-1,-1,-1,-1,173,-1,-1,-1,-1,-1,-1,-1,174,-1,-1,-1,-1,-1,-1,-1,175,-1,-1,-1,-1,-1,-1,-1,176,-1,-1,-1,-1,-1,-1,-1,177,-1,-1,-1,-1,-1,-1,-1,178,-1,-1,-1,-1,-1,-1,-1,179,-1,-1,-1,-1,-1,-1,-1,180,-1,-1,-1,-1,-1,-1,-1,181,-1,-1,-1,-1,-1,-1,-1,182,-1,-1,-1,-1,-1,-1,-1,183,-1,-1,-1,-1,-1,-1,-1,184,-1,-1,-1,-1,-1,-1,-1,185,-1,-1,-1,-1,-1,-1,-1,186,-1,-1,-1,-1,-1,-1,-1,187,};

static short tc_tab_f1[188] = {
    3, 7, 19, 7, 7, 11, 5, 11, 7, 41, 103, 15, 9, 17, 9, 21, 101, 21, 57, 23, 13, 27, 11, 27, 85,
    29, 33, 15, 17, 33, 103, 19, 19, 37, 19, 21, 21, 115, 193, 21, 133, 81, 45, 23, 243, 151,
    155, 25, 51, 47, 91, 29, 29, 247, 29, 89, 91, 157, 55, 31, 17, 35, 227, 65, 19, 37, 41, 39,
    185, 43, 21, 155, 79, 139, 23, 217, 25, 17, 127, 25, 239, 17, 137, 215, 29, 15, 147, 29,
    59, 65, 55, 31, 17, 171, 67, 35, 19, 39, 19, 199, 21, 211, 21, 43, 149, 45, 49, 71, 13, 17,
    25, 183, 55, 127, 27, 29, 29, 57, 45, 31, 59, 185, 113, 31, 17, 171, 209, 253, 367, 265,
    181, 39, 27, 127, 143, 43, 29, 45, 157, 47, 13, 111, 443, 51, 51, 451, 257, 57, 313, 271,
    179, 331, 363, 375, 127, 31, 33, 43, 33, 477, 35, 233, 357, 337, 37, 71, 71, 37, 39, 127,
    39, 39, 31, 113, 41, 251, 43, 21, 43, 45, 45, 161, 89, 323, 47, 23, 47, 263
};

static short tc_tab_f2[188] = {
    10, 12, 42, 16, 18, 20, 22, 24, 26, 84, 90, 32, 34, 108, 38, 120, 84, 44, 46, 48, 50, 52, 36,
    56, 58, 60, 62, 32, 198, 68, 210, 36, 74, 76, 78, 120, 82, 84, 86, 44, 90, 46, 94, 48, 98, 40,
    102, 52, 106, 72, 110, 168, 114, 58, 118, 180, 122, 62, 84, 64, 66, 68, 420, 96, 74, 76, 234,
    80, 82, 252, 86, 44, 120, 92, 94, 48, 98, 80, 102, 52, 106, 48, 110, 112, 114, 58, 118, 60, 122,
    124, 84, 64, 66, 204, 140, 72, 74, 76, 78, 240, 82, 252, 86, 88, 60, 92, 846, 48, 28, 80, 102,
    104, 954, 96, 110, 112, 114, 116, 354, 120, 610, 124, 420, 64, 66, 136, 420, 216, 444, 456,
    468, 80, 164, 504, 172, 88, 300, 92, 188, 96, 28, 240, 204, 104, 212, 192, 220, 336, 228, 232,
    236, 120, 244, 248, 168, 64, 130, 264, 134, 408, 138, 280, 142, 480, 146, 444, 120, 152, 462,
    234, 158, 80, 96, 902, 166, 336, 170, 86, 174, 176, 178, 120, 182, 184, 186, 94, 190, 480
};
void
LteDl_computeCTCQPPIndcs_Opt
(
	int Ktype,
	unsigned short* indices
);
void
LteDl_turbo_interleave
(
	int len,
	unsigned short *  inter
)
{
    int i, index;
    int f1, f2;
    static int previous_len=-1;

    //had the size changed from previous generation. If no, then just simply quit (no generation required)
//    if (previous_len==len)
//    	return;

    //new size, thus generation is required
    previous_len=len;

    if(len <= 512)
    {
        index = (len >> 3) - 5;
    }
    else
    {
        if(len <= 1024)
        {
            index = (len >> 4) + 27;
        }
        else
        {
            if(len <= 2048)
            {
                index = (len >> 5) + 59;
            }
            else
                index = (len >> 6) + 91;
        }
	}

    if ((len%8==0)&&(KindexTable[(len-40)>>3]!=-1))
    {
    	LteDl_computeCTCQPPIndcs_Opt(KindexTable[(len-40)>>3],inter);
    }
    else
    {
		//go for the non optimized version
		f1 = tc_tab_f1[index];
		f2 = tc_tab_f2[index];
		for(i = 0; i < len; i++)
		{
			inter[i] = (unsigned short) (((i % len) * ((f1 + f2 * i) % len) % len));
		}
    }

    return;
}
void
LteDl_computeCTCQPPIndcs_Opt
(
	int Ktype,
	unsigned short* indices
)
{
	int i;
	int size=lte_dl_turbo_enc_intlv_params[Ktype][0];

	unsigned short currF[16],
				   currG[16];
	unsigned short Nvec[16],
				   Pvec[16];
	unsigned short tmp[16];

	__sb_rbroad(Nvec,(int)(lte_dl_turbo_enc_intlv_params[Ktype][0]<<16),0);

	__sb_rcopy(currF,lte_dl_initFs[Ktype]);
	__sb_rcopy(indices,currF);
	__sb_rbroad(Pvec,(int)(lte_dl_initFwdParams0[Ktype][0]<<16),0);

	if(lte_dl_initFwdParams0[Ktype][2]==-1)
		__sb_rbroad(currG,(int)(lte_dl_initFwdParams0[Ktype][1]<<16),0);
	else
		__sb_rcopy(currG,lte_dl_initFwdParams1[lte_dl_initFwdParams0[Ktype][2]]);

	for(i=0;i<(size-16);i+=16){
		__sb_radd(currF,currF,currG);
		__sb_rsubf(tmp,Nvec,currF);
		__sb_rseltrue(currF,__sb_rcmplt(currF,Nvec),tmp,currF);
		__sb_radd(currG,currG,Pvec);
		__sb_rsubf(tmp,Nvec,currG);
		__sb_rseltrue(currG,__sb_rcmplt(currG,Nvec),tmp,currG);
		__sb_rcopy(indices+16+i,currF);
	}
}
